package com.aichongbang.acb.controller;

import com.aichongbang.acb.po.Pet;
import com.aichongbang.acb.service.IPetService;
import com.aichongbang.acb.util.ResultVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author acb
 * @since 2021-05-27
 */
@RestController
@RequestMapping("/pet")
public class PetController {

    @Resource
    private IPetService iPetService;
    @GetMapping(value = "/list")
    @ResponseBody
    public ResultVO getAll(){
        List<Pet> userVOList = iPetService.getAll();
        return ResultVO.success(userVOList);
    }

    @GetMapping(value = "/add")
    @ResponseBody
    public ResultVO add(Pet pet){
        int userVOList = iPetService.add(pet);
        return ResultVO.success(userVOList);
    }
    @GetMapping(value = "/delete")
    @ResponseBody
    public ResultVO delete(Integer id){
        boolean userVOList = iPetService.delete(id);
        return ResultVO.success(userVOList);
    }
}
